Initialize xgselect in function xg_select when gfds_size == 0.
authorKarel Klíč <kklic@redhat.com>
Fri, 25 Nov 2011 15:36:04 +0000 (16:36 +0100)
committerRob Browning <rlb@defaultvalue.org>
Sat, 7 Apr 2012 19:34:50 +0000 (14:34 -0500)
Emacs should no longer hang when using newer versions of GLib
(initially reported against libglib2.0-0 2.32.0-2).

Origin: http://pkgs.fedoraproject.org/gitweb/?p=emacs.git;a=commitdiff;h=a2302b156dba1cc136e8363605d78a66eb3a92a6
Bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9754
Bug-Red-Hat: https://bugzilla.redhat.com/show_bug.cgi?id=711739
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=666691
Applied-Upstream: Fixed in Emacs 24

src/xgselect.c

index 333f7b132c763750805d7f4cb7eb7d871d4bd7d0..7bb5f00676f6a850edd43ec533e8f16b02f0a611 100644 (file)
@@ -55,10 +55,15 @@ xg_select (max_fds, rfds, wfds, efds, timeout)
   do {
     if (n_gfds > gfds_size) 
       {
-        while (n_gfds > gfds_size) 
-          gfds_size *= 2;
-        xfree (gfds);
-        gfds = xmalloc (sizeof (*gfds) * gfds_size);
+        if (gfds_size == 0)
+          xgselect_initialize ();
+        else
+          {
+            while (n_gfds > gfds_size)
+              gfds_size *= 2;
+            xfree (gfds);
+            gfds = xmalloc (sizeof (*gfds) * gfds_size);
+          }
       }
 
     n_gfds = g_main_context_query (context,